<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("fnId", request.getAttribute("fnId"));
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
</head>
<body class="gray-bg">
	<nav class="huiNav">
		<%@include file="project-nav.jsp" %>需求变更
		<a class="btn btn-info  btn-sm pull-right"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="fa fa-refresh"></i></a>
	</nav>

	<div class="ibox-content">
	<!-- 搜索框部分start -->
	<%-- <p:btn value="serch"> --%>
		<form class="form-inline" id="serchform">
		    <input type="hidden" name="projId" id="projId" value="${param.projId}"> 
			<div class="form-group mr-20">
				<label for="exampleInputName2">标题</label>
				<input name="title" type="text" class="form-control">
			</div>
			<div class="form-group mr-20">
				<label for="exampleInputName2">问题类型</label>
				 <select class="form-control autoFull" name="needType" dataType="*1-20"
					data-url="${path}/admin/dataDictionary/showDataDictionary" 
					data-filed="name" 
					data-value="name"
					data-param="{type:'问题类型'}"
					>
					<option value="">--请选择问题类型--</option>
				</select>
			</div>
			<div class="form-group mr-20">
			 <select class="form-control autoFull select2" name="handleResult" dataType="*1-20"
					data-url="${path}/admin/dataDictionary/showDataDictionary" 
					data-filed="name" 
					data-value="name"
					data-param="{type:'问题处理结果'}"
					data-def="${obj.handleResult}"
					>
					<option value="">--请选择处理结果--</option>
				</select>
			</div>
			<div class="form-group mr-20">
			  	<label for="exampleInputName2">模块</label>
			  	
			    <select class="form-control autoFull select2" name="interfaceId" id="parentId">
					<option value="">--请选择所属模块--</option>
				</select>
			</div>
			<button  onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm"><i class="fa fa-search " ></i> 搜索</button>
			<button  type="reset" class="btn btn-info btn-sm"><i class="fa fa-refresh " ></i> 重置</button>
		</form>
	<%-- 	</p:btn> --%>
	<!-- 搜索框部分en -->
		<div class="option-bar" >
		<%-- <p:btn value="dels">
			<button onclick="myGrid.delItems()" type="button" class="btn btn-danger btn-sm"><i class="fa fa-trash" ></i>批量删除</button>
		 </p:btn>
		<p:btn value="add"> 
			<button onclick="openAdd()" type="button" class="btn btn-success btn-sm"><i class="fa fa-plus" ></i>  新增</button>
		</p:btn> --%>
		</div>
		<table id="mgrid" >
			<thead>
				<tr>
					<th data-checkbox="true"  ></th>
					<th data-formatter="MGrid.indexfn" data-align="center"  data-width="30px" >序号</th>
					<th data-field="title">标题</th>
					<th data-field="createClientName" >创建人</th>
					<th data-field="createTime" data-sortable="true" data-formatter="MGrid.getTimeDD">提交时间</th>
					<th data-field="needType" >问题类型</th>
					<th data-field="interfaceName" >所属模块</th>
					<th data-field="handleResult" data-formatter="changeResultStyle" >处理结果</th>
					<th data-field="handleUserName" >处理人</th>
					<th data-field="taskStatus" >是否创建任务</th>
					<th data-align="center"  data-width="200px" data-field="id" data-formatter="buidOperate">操作</th>
				</tr>
			</thead>
		</table>
	</div>
	
	<script type="text/javascript">
	

	var myGrid;
		$(function(){
			//select 自动填充
			  MTools.autoFullSelect();
			  //树形结构
			  initFunctionList();
			  myGrid=MGrid.initGrid({
				 url:"${path}/admin/changes/showList",
				 delUrl:"${path}/admin/changes/del"
			 }); 
		});
		function buidOperate(value, row, index){
			var html='';
			if(row.fileUrl!=''){
			html+='<a class="btn btn-default btn-sm mr-5" href="'+row.fileUrl+'" title="下载附件"><i class="glyphicon glyphicon-download"></i></a>';
			}
			html+='<button class="btn btn-default btn-sm mr-5" onClick="openShow('+value+')"  title="查看"><i class="fa fa-search"></i></buttoun>'
			html+='<button class="btn btn-default btn-sm mr-5" onClick="openEdit('+value+')"  title="处理"><i class="fa fa-legal "></i></buttoun>'
/* 			html+='<button class="btn btn-default btn-sm" onClick="myGrid.delItem('+value+')" title="删除"><i class="fa fa-lg fa-trash-o"></i></buttoun>';
 */		
			html+=''
			return html; 
		}
		//打开添加界面
		function openAdd() {
			layer.open({
				type : 2,
				title : "添加需求变更",
				area : [ MUI.SIZE_L, '450px' ],
				content : [ '${path}/admin/changes/editForm?projId='+projId+'']
			});
		}
		//打开编辑界面
		function openEdit(id) {
			layer.full(
			layer.open({
				type : 2,
				title : "编辑问题反馈",
				area : [ MUI.SIZE_L, '450px' ],
				maxmin : true,
				content : [ '${path}/admin/changes/editForm?id=' + id]
			}));
		}
		
		//打开查看界面
		function openShow(id) {
			layer.open({
				type : 2,
				title : "查看问题反馈",
				area : [ MUI.SIZE_L, '450px' ],
				maxmin : true,
				content : [ '${path}/admin/changes/showForm?id=' + id]
			});
		}
		
		/**
		 * 初始化模块
		 */
		function initFunctionList() {
			$.AjaxProxy({
				a : false,
				c : false
			}).invoke("${path}/admin/interfaceCate/all?projId=${param.projId}", function(loj) {
				$("#parentId").createSelectTree(loj.attr("result").rows, {
					append : true,
					value:"name"
				});
			});
		
		}
		
		//改变bug等级样式		
		function changeResultStyle(value, row, index){
			var html="";
			if(value == '不予处理'){
				html = '<span class="badge badge-danger">'+value+'</span>';
			}else if(value == '已处理完毕'){
				html = '<span class="badge badge-success">'+value+'</span>';
			}else if(value == '已安排处理'){
				html = '<span class="badge badge-info">'+value+'</span>';
			}
			else if(value == '与客户确认中'){
				html = '<span class="badge badge-info">'+value+'</span>';
			}else{
				html = '<span class="badge badge-warning">'+value+'</span>';
			}
			return html;
		}
	</script>
</body>
</html>
